<?php
$cid        = gpc_getStringArray('cid');
$name       = "";

if(count($cid)==0)
{
    $cid[0]=$id;
}

foreach($cid as $id)
{
    if(hasChildProductCat($id))
    {
    	$msg = "Can't Delete Category - (Has Childs)!";
     	page_transfer($msg,$pagetr);
    	exit();
    	
    }
    elseif (hasChildProduct($id))
    {
    	$msg = "Can't Delete Category - (Has product)!";
     	page_transfer($msg,$pagetr);
    	exit();	
    }
    
    //---------------Lay thong tin ve categories sap xoa
    $sql_select = "SELECT cName FROM tblproduct_category WHERE iId = $id";
    $rs=$dbsql->query($sql_select);
    while ($result = $dbsql->fetch_array($rs))
    {
    	$CategoriesName = $result["cName"];
    }
    
    $sql_delete = "DELETE FROM tblproduct_category WHERE iId = $id and cLanguage='$language'";
    $dbsql->query($sql_delete);
    
    Delete_Property($id);
    Insert_Tracking(" Del Product: $CategoriesName");
}  

$msg = "Delete Category Success!";
page_transfer($msg,$pagetr);
exit();
?>